import React from 'react'
import axios from 'axios'
import Layout from '../components/layout'
import { List, Divider } from 'antd'

class Page1 extends React.Component {
  state = {
    listData: [], // 数据列表
  }

  componentDidMount() {
    axios.get('/api/hello').then(res => {
      console.log(res)
      let listData = res.data.data
      this.setState({
        listData
      })
    })
  }

  render() {
    let { listData } = this.state
    return (
      <>
        <Layout _key="1">
          <Divider orientation="left">Default Size</Divider>
          <List
            header={<div>Header</div>}
            footer={<div>Footer</div>}
            bordered
            dataSource={listData}
            renderItem={item => (
              <List.Item>
                {item}
              </List.Item>
            )}
          />
        </Layout>
      </>
    )
  }
}

export default Page1